﻿@using SplendidCRM.Ext
@using SplendidCRM.Ext.CCBackendService
@using SplendidCRM.Ext.Helpers

@model QueryBasicInfoResult


@{
    var formId = Guid.NewGuid();
}

<div id="@formId" class="form-grid">
<div  class="form-header">Result query</div>
<div style="font-size: 10pt;font-weight: bold; font-style:italic"> CUSTOMER INFO </div>
<div class="form-section ui-inline-template" data-bind="each: { source: Customer }">
    @Html.Field(FieldType.Span, "Name", "text:Name")
    @Html.Field(FieldType.Span, "Code", "text:Code")
    @Html.Field(FieldType.Span, "IdType", "text:IdType")
    @Html.Field(FieldType.Span, "IdCode", "text:IdCode")
    @Html.Field(FieldType.Span, "Gender", "text:Gender")
    @Html.Field(FieldType.Span, "Birthday", "text:Birthday")
    @Html.Field(FieldType.Span, "Address", "text:Address")
    @Html.Field(FieldType.Span, "Grade", "text:Grade")
    @Html.Field(FieldType.Span, "Email", "text:Email")
    @Html.Field(FieldType.Span, "ZipCode", "text:ZipCode")
    @Html.Field(FieldType.Span, "RegistrationTime", "text:RegistrationTime")
    @Html.Field(FieldType.Span, "CustomerType", "text:CustomerType")
    @Html.Field(FieldType.Span, "Country", "text:Country")
    @Html.Field(FieldType.Span, "NativePlace", "text:NativePlace")
    @Html.Field(FieldType.Span, "NationType", "text:NationType")
    @Html.Field(FieldType.Span, "SocialNo", "text:SocialNo")
</div>                                    

<div class="clear"></div>

<div style="font-size: 10pt;font-weight: bold; font-style:italic;margin-top:20px"> ACCOUNTS </div>
<div class="form-grid">
<table>
            <thead>
                <tr>
                    <td>Name</td>
                    <td>Code </td>
                    <td>Address</td>
                    <td>Title</td>
                    <td>BillcycleType</td>
                    <td>RelationCustomer</td>
                </tr>
            </thead>
            <tbody class="ui-inline-template" data-bind="each: { source: Account }">
                <tr>
                    <td>${format(data.Name)}</td>
                    <td>${format(data.Code )}</td>
                    <td>${format(data.Address)}</td>
                    <td>${format(data.Title)}</td>
                    <td>${format(data.BillcycleType)}</td>
                    <td>${format(data.RelationCustomer)}</td>
                </tr>
            </tbody>
        </table>
</div>


<div class="clear"></div>
<div style="font-size: 10pt;font-weight: bold; font-style:italic"> SUBSCRIBER </div>
<div >
    <div class="form-section">
        @Html.Field(FieldType.Span, new { fieldLabel = "IMSI",  innerText = @Model.Subscriber.Subscriber.IMSI })
        @Html.Field(FieldType.Span, new { fieldLabel = "Code" ,  innerText = @Model.Subscriber.Subscriber.Code})
        @Html.Field(FieldType.Span, new { fieldLabel = "BrandId",  innerText = @Model.Subscriber.Subscriber.BrandId})
        @Html.Field(FieldType.Span, new { fieldLabel = "RegistrationTime",  innerText = @Model.Subscriber.Subscriber.RegistrationTime.ToStandardDatetime()})
        @Html.Field(FieldType.Span, new { fieldLabel = "Lang",  innerText = @Model.Subscriber.Subscriber.Lang})
        @Html.Field(FieldType.Span, new { fieldLabel = "SMSLang",  innerText = @Model.Subscriber.Subscriber.SMSLang})
        @Html.Field(FieldType.Span, new { fieldLabel = "PaidMode",  innerText = @Model.Subscriber.Subscriber.PaidMode})
        @Html.Field(FieldType.Span, new { fieldLabel = "InitialCredit",  innerText = @Model.Subscriber.Subscriber.InitialCredit})
        @Html.Field(FieldType.Span, new { fieldLabel = "InitialCreditSpecified",  innerText = @Model.Subscriber.Subscriber.InitialCreditSpecified})
        @Html.Field(FieldType.Span, new { fieldLabel = "BelToAreaID",  innerText = @Model.Subscriber.Subscriber.BelToAreaID})
        @Html.Field(FieldType.Span, new { fieldLabel = "MainProductID",  innerText = @Model.Subscriber.Subscriber.MainProductID})
        @Html.Field(FieldType.Span, new { fieldLabel = "LastRechargeTime",  innerText = @Model.Subscriber.Subscriber.LastRechargeTime.ToStandardDatetime()})
        @Html.Field(FieldType.Span, new { fieldLabel = "LastCallTime",  innerText = @Model.Subscriber.Subscriber.LastCallTime.ToStandardDatetime()})
        @Html.Field(FieldType.Span, new { fieldLabel = "SMSAmount",  innerText = @Model.Subscriber.Subscriber.SMSAmount})
    </div>

<div  class="clear" style="font-size: 10pt;font-weight: bold; font-style:italic"> PRODUCTS </div>
   <table>
            <thead>
                <tr>
                    <td>Name</td>
                    <td>ProductOrderKey</td>
                    <td>EffectiveDate</td>
                    <td>ExpiredDate</td>
                    <td>status</td>
                    <td>CurCycleStartTime</td>
                    <td>CurCycleEndTime</td>
                    <td>BillStatus</td>
                    <td>BindSubscriberNo</td>
                </tr>
            </thead>
            <tbody>
            @foreach (var p in Model.Subscriber.Product) {
                <tr>
                    <td>@p.Name</td>
                    <td>@p.ProductOrderKey</td>
                    <td>@p.EffectiveDate.ToStandardDatetime()</td>
                    <td>@p.ExpiredDate.ToStandardDatetime()</td>
                    <td>@p.status</td>
                    <td>@p.CurCycleStartTime.ToStandardDatetime()</td>
                    <td>@p.CurCycleEndTime.ToStandardDatetime()</td>
                    <td>@p.BillStatus</td>
                    <td>@p.BindSubscriberNo</td>
                </tr>
                 }
            </tbody>
        </table>

<div  class="clear" style="font-size: 10pt;font-weight: bold; font-style:italic"> SERVICES </div>
   <table>
            <thead>
                <tr>
                    <td>Status</td>
                    <td>RegistrationTime</td>
                    <td>Id</td>
                </tr>
            </thead>
            <tbody>
            @foreach (var acc in Model.Subscriber.Service) {
                <tr>
                    <td>@acc.Status</td>
                    <td>@acc.RegistrationTime.ToStandardDatetime()</td>
                    <td>@acc.Id </td>
                </tr>
            }
            </tbody>
        </table>

</div>

</div>
<script type="text/javascript">
$(function () {
    var model = @Html.Raw(Model.Json(true)) ;
    linq.model(model, '#@formId');
});

</script>
